{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Implement a Queue\n",
    "\n",
    "It's very common to be asked to implement a Queue class! The class should be able to do the following:\n",
    "\n",
    "* Check if Queue is Empty\n",
    "* Enqueue\n",
    "* Dequeue\n",
    "* Return the size of the Queue"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Queue(object):\n",
    "    def __init__(self):\n",
    "        self.items = []\n",
    "    def is_empty(self):\n",
    "        return self.items == []\n",
    "    def enqueue(self, e):\n",
    "        self.items.insert(0, e)\n",
    "    def dequeue(self):\n",
    "        return self.items.pop()\n",
    "    def size(self):\n",
    "        return len(self.items)\n",
    "    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "two\n",
      "3\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q = Queue()\n",
    "q.is_empty()\n",
    "q.enqueue(1)\n",
    "q.enqueue('two')\n",
    "q.enqueue(3)\n",
    "q.size()\n",
    "print(q.dequeue())\n",
    "print(q.dequeue())\n",
    "print(q.dequeue())\n",
    "q.is_empty()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
